﻿using System.ComponentModel.DataAnnotations;
using MaxStoreErp.Core.BaseClasses;

namespace MaxStoreShop.Domain.Directories
{
    /// <summary>
    /// Личность
    /// </summary>
    public class Character : EntityBase
    {
        string _firstName;
        string _lastName;
        string _middleName;
        string _phone;
        string _placeOfResidence;
        string _note;
        byte[] _photo;

        /// <summary>
        /// Имя
        /// </summary>
        [Required]
        [StringLength(150)]
        public string FirstName
        {
            get { return _firstName; }
            set { OnPropertyChanged(ref _firstName, value, "FirstName"); }
        }

        /// <summary>
        /// Фамилия
        /// </summary>
        [Required]
        [StringLength(150)]
        public string LastName
        {
            get { return _lastName; }
            set { OnPropertyChanged(ref _lastName, value, "LastName"); }
        }

        /// <summary>
        /// Отчество
        /// </summary>
        public string MiddleName
        {
            get { return _middleName; }
            set { OnPropertyChanged(ref _middleName, value, "MiddleName"); }
        }

        /// <summary>
        /// Контактный телефон
        /// </summary>
        [Required]
        [StringLength(150)]
        public string Phone
        {
            get { return _phone; }
            set { OnPropertyChanged(ref _phone, value, "Phone"); }
        }

        /// <summary>
        /// Место жительства
        /// </summary>
        public string PlaceOfResidence
        {
            get { return _placeOfResidence; }
            set { OnPropertyChanged(ref _placeOfResidence, value, "PlaceOfResidence"); }
        }

        /// <summary>
        /// Примечание
        /// </summary>
        public string Note
        {
            get { return _note; }
            set { OnPropertyChanged(ref _note, value, "Note"); }
        }

        /// <summary>
        /// Фотография личности
        /// </summary>
        public byte[] Photo
        {
            get { return _photo; }
            set { OnPropertyChanged(ref _photo, value, "Photo"); }
        }

        public override string ToString()
        {
            return string.Format("{0} {1} {2}", LastName, FirstName, string.IsNullOrWhiteSpace(MiddleName) ? string.Empty : MiddleName);
        }
    }
}
